
<?php
include_once 'Classes/User.class.php';

class FollowingsTemplate {

    // Dhmiourgei thn html gia mia lista apo users
    function __invoke($followings){
            if($followings)
            {
                $i=0;
                while($i<count($followings))
                {
                    $userid = $followings[$i]->userId;
                    $username = $followings[$i]->username;
                    $email = $followings[$i]->email;
                    $curLocation = $followings[$i]->currentLocation;
                    $gravatarHash = md5(trim(strtolower($email)));
                    if(strlen($curLocation) == 0)
                    {
                       $curLocation = "Ο χρήστης δεν έχει ορίσει τρέχουσα τοποθεσία.";
                    }

                    echo <<<END
                    <ul id=following$i>
                    <li> <img src="http://www.gravatar.com/avatar/$gravatarHash" ></li>
                    <li> Username: $username </li>
                    <li><a href="user.php?userId=$userid">Προφίλ</a></li>
                    <li> Current location: $curLocation </li>
                    </ul>
END;
                    $i++;
                }
            }
            else
            {
                echo "Ο χρήστης δεν παρακολουθεί κανέναν.";
            }
    }
}

?>

